package com.lm.geodesy.example;

import org.gavaghan.geodesy.Ellipsoid;
import org.gavaghan.geodesy.GeodeticCalculator;
import org.gavaghan.geodesy.GlobalCoordinates;

public class BoundaryExample {
    public static void main(String[] args) {
        GlobalCoordinates center = new GlobalCoordinates(34.052235, -118.243683); // 洛杉矶

        // 距离范围（米）
        double radius = 50000; // 50 公里

        GeodeticCalculator calculator = new GeodeticCalculator();
        Ellipsoid reference = Ellipsoid.WGS84;

        // 计算4个方向的边界点
        double[] azimuths = {0, 90, 180, 270}; // 北、东、南、西
        for (double azimuth : azimuths) {
            GlobalCoordinates boundaryPoint = calculator.calculateEndingGlobalCoordinates(
                    reference, center, azimuth, radius);

            System.out.println("方位角 " + azimuth + " 的边界点:");
            System.out.println("纬度: " + boundaryPoint.getLatitude());
            System.out.println("经度: " + boundaryPoint.getLongitude());
        }
    }
}

